Choice of network interface for establishing a bridge on if NFSROOT is used
authorKeir Fraser <keir.fraser@citrix.com>
Mon, 14 Jul 2008 09:04:41 +0000 (10:04 +0100)
committerKeir Fraser <keir.fraser@citrix.com>
Mon, 14 Jul 2008 09:04:41 +0000 (10:04 +0100)
commit96f900ef40028defeff979e28121e48a46941157
treeb8d837fdc0f6d442319ea0dabbcb44f81fde1e44
parent121068a2ce684723ea7b6aca4b5c15b418c86784
Choice of network interface for establishing a bridge on if NFSROOT is used

This patch fixes a problem related to machines that are booted using
nfsroot ( '/' provided via nfs). Previously the code was assuming that
nfsroot would be provided via eth0. Now this additional code checks
over which interface the nfsroot is provided after detecting that
nfsroot is actually being used. To determine from where nfsroot is
mounted I am reading the kernel command line (/proc/cmdline) and
filter for an argument starting with 'nfsroot=' and determine the nfs
server's IP address by assuming the format 'nfsroot=<ip
adddress>:<path to root>' - if there's a better way of doing this,
please let me know.  After that I determine the interface over which
this IP address would be accessed using 'ip route get <address>'. Then
I compare that interface against a previously determined default
interface and if they are equal return a value that causes an
alternative interface to be chosen.

Signed-off-by: Stefan Berger <stefanb@us.ibm.com>
tools/examples/network-bridge